#include "widget.h"
#include "ui_widget.h"
#include<QResizeEvent>
#include<QDebug>
#include<QTimer>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->label->setTextFormat(Qt::PlainText);
//    ui->label->setText("#这是一段纯文本");
    ui->label_2->setTextFormat(Qt::RichText);
    ui->label_2->setText("<b>这是一段富文本</b>");
    ui->label_3->setTextFormat(Qt::MarkdownText);
    ui->label_3->setText("# 这是一段markdown文本");
//    QRect windowrect=this->geometry();
//    ui->label_4->setGeometry(0,0,windowrect.width(),windowrect.height());
//    QPixmap pixmap(":/lufei.gif");
//    ui->label_4->setPixmap(pixmap);
//    ui->label_4->setScaledContents(true);
      ui->label->setWordWrap(true);
      ui->label->setIndent(30);
      ui->label_6->setBuddy(ui->radioButton);
      ui->label_7->setBuddy(ui->radioButton_2);
      ui->lcdNumber->display(10);
      timer=new QTimer(this);
      connect(timer,&QTimer::timeout,this,&Widget::handle);
      timer->start(1000);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handle()
{
    int value=ui->lcdNumber->intValue();
    if(value<=0)
    {
        ui->lcdNumber->display(10);
        return;
    }
    else
    {
        ui->lcdNumber->display(value-1);
    }
}

//void Widget::resizeEvent(QResizeEvent *event)
//{
//    qDebug()<<event->size();
//    ui->label_4->setGeometry(0,0,event->size().width(),event->size().height());
//}

